/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package jp.co.irep.juten.entity;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author toan_nguyen
 */
@Entity
@Table(name = "item_duplicate")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ItemDuplicate.findAll", query = "SELECT i FROM ItemDuplicate i"),
    @NamedQuery(name = "ItemDuplicate.findByManageNo", query = "SELECT i FROM ItemDuplicate i WHERE i.itemDuplicatePK.manageNo = :manageNo"),
    @NamedQuery(name = "ItemDuplicate.findByItemName", query = "SELECT i FROM ItemDuplicate i WHERE i.itemDuplicatePK.itemName = :itemName"),
    @NamedQuery(name = "ItemDuplicate.findByDupNum", query = "SELECT i FROM ItemDuplicate i WHERE i.dupNum = :dupNum")})
public class ItemDuplicate implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected ItemDuplicatePK itemDuplicatePK;
    @Column(name = "dup_num")
    private Integer dupNum;

    public ItemDuplicate() {
    }

    public ItemDuplicate(ItemDuplicatePK itemDuplicatePK) {
        this.itemDuplicatePK = itemDuplicatePK;
    }

    public ItemDuplicate(int manageNo, short itemName) {
        this.itemDuplicatePK = new ItemDuplicatePK(manageNo, itemName);
    }

    public ItemDuplicatePK getItemDuplicatePK() {
        return itemDuplicatePK;
    }

    public void setItemDuplicatePK(ItemDuplicatePK itemDuplicatePK) {
        this.itemDuplicatePK = itemDuplicatePK;
    }

    public Integer getDupNum() {
        return dupNum;
    }

    public void setDupNum(Integer dupNum) {
        this.dupNum = dupNum;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (itemDuplicatePK != null ? itemDuplicatePK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ItemDuplicate)) {
            return false;
        }
        ItemDuplicate other = (ItemDuplicate) object;
        if ((this.itemDuplicatePK == null && other.itemDuplicatePK != null) || (this.itemDuplicatePK != null && !this.itemDuplicatePK.equals(other.itemDuplicatePK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "jp.co.irep.tech.juten.jpa.entity.ItemDuplicate[ itemDuplicatePK=" + itemDuplicatePK + " ]";
    }
    
}
